{template header}
<style type="text/css">
    .icon-plus{float: right;margin: 4px;}
    img.postImg {height: 100px;}
    img.header {max-height: 40px; max-width: 40px;float: left;margin-top: 10px;}
    .span6 button{margin-top:10px;height: 45px;}
    .thumbnail > a > img {display: block;margin-left: auto;margin-right: auto;max-width: 100%;}
</style>
<script type="text/javascript">
    $(document).ready(function(){
        $(".float-top-right > i.icon-plus").click(function(){
            var uid = $(this).siblings("#uid").val();
            var img = $(this).siblings("#img").val();
            if(addtoAlternateList(uid, img))
            {
                $(this).parents("li.span2").fadeOut(2000);
            }
        });
    });
    function addtoAlternateList(uid, img)
    {
        var rel = false;
        $.ajax({url:"index.php?c=admin&a=friendRecAddAlternate",
            async:false,
            dataType:"json",
            data:{
                "selected":1,
                "uid":uid,
                "img":img
            },
            error:function(){
                    alert('未知错误');
                },
            success:function(data, status){
                turnData = eval(data);
                if(turnData.err == 0)
                {
                    rel = true;
                    $(".alert").children("span").text('用户ID:'+uid+', 图片：'+img+'添加成功');
                }
                else
                {
                    alert(turnData.message);
                    rel = false;
                }
            }
        });
        return rel;
    }
</script>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <div class="row-fluid" style="margin-bottom:10px;">
                <div class="span4">
                    <a href="index.php?c=admin&a=friendRecAlternateList">
                        <button class="btn" type="button">备选的用户-图片</button>
                    </a>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12">
                    <div class="alert">
                         <button type="button" class="close" data-dismiss="alert">×</button>
                        <h4>
                            提示!
                        </h4>
                        <span>点击加号将用户-图片加入备选用户列表</span>
                    </div>
                </div>
            </div>
        </div>
        <div class="span12">
            <ul class="thumbnails">
                {loop $list $k $v}
                <li class="span2">
                    <div class="thumbnail">
                        <div class="float-top-right">
                            <i class="icon-plus"></i>
                            <input type="hidden" id="uid" value="{$v['uid']}">
                            <input type="hidden" id="img" value="{$v['img']}">
                        </div>
                        <a href="#postImg_{$k}" data-toggle="modal">
                            <img class="postImg" src="{$v['img']}" />
                        </a>
                        <div id="postImg_{$k}" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                <h3 id="myModalLabel">帖子大图</h3>
                            </div>
                            <div class="modal-body" style="height:700px;">
                                <img src="{$v['img']}">
                            </div>
                        </div>
                        <div class="row-fluid">
                            <div class="span4">
                                <img class="header img-circle" src="{$v['header']}" />
                            </div>
                            <div class="span6">
                                <a href="index.php?c=admin&a=postImgListbyUser&uid={$v['uid']}">
                                    <button class="btn btn-block btn-info" type="button">{$v['nickname']}</button>
                                </a>
                            </div>
                        </div>
                    </div>
                </li>
                {/loop}
            </ul>
            </form>
        </div>
    </div>
</div>
<div class="pagination">
    <ul>
        {$pageStr}
    </ul>
</div>
{template footer}